<#-- @ftlvariable name="entity" type="com.xci.platform.auth.entity.ModuleEntity" -->
<#-- @ftlvariable name="parentName" type="java.lang.String" -->
<#include "/_inc/_layout.ftl">
<#assign url=html.saveUrls("/auth/module/create-save","/auth/module/edit-save")/>
<@header/>
<div class="jxpanel winpanel" data-fit="true">
    <form id="editform" class="jxform" method="post" action="${url}">
        <input name="id" value="${entity.id!}" type="hidden">
        <input name="parentId" value="${entity.parentId!}" type="hidden">
        <input name="leaf" value="1" type="hidden">
        <table class="table jxtable-form">
            <tr>
                <th class="w-100px">上级</th>
                <td>
                    <p class="form-control-static">${parentName!}</p>
                </td>
            </tr>
            <tr>
                <th>编码</th>
                <td>
                    <input class="form-control" name="code" value="${entity.code!}" maxlength="50"
                           data-validate="required: [true,'请输入模块编码'],maxlength: 50" autocomplete="off"/>
                </td>
            </tr>
            <tr>
                <th>名称</th>
                <td>
                    <input class="form-control" name="name" value="${entity.name!}" maxlength="50"
                           data-validate="required: [true,'请输入模块名称'],maxlength: 50" autocomplete="off"/>
                </td>
            </tr>
            <tr>
                <th>图标样式</th>
                <td>
                    <div class="input-group">
                        <span class="input-group-btn">
                            <button id="btnIconCls" class="btn btn-default color-green" type="button">
                                <#if helper.isNotBlank(entity.iconCls)>
                                    <i class="fa-lg ${entity.iconCls!}"></i>
                                <#else>
                                    <i class="fa-lg icon-flag"></i>
                                </#if>
                            </button>
                        </span>
                        <input class="form-control" id="iconCls" name="iconCls" value="${entity.iconCls!}" style="height: auto;"
                               data-validate="maxlength: 90" maxlength="90" autocomplete="off" spellcheck="false"/>
                        <span class="input-group-btn">
                            <button id="selectIconCls" class="btn btn-default" type="button">
                                选择图标
                            </button>
                        </span>
                    </div>
                </td>
            </tr>
            <tr>
                <th>地址</th>
                <td>
                    <textarea class="form-control" name="url" maxlength="200" data-validate="maxlength: 200" rows="2"
                              style="resize: none">${entity.url!}</textarea>
                </td>
            </tr>
            <tr>
                <th>窗口类</th>
                <td>
                    <textarea class="form-control" name="provider" maxlength="300" data-validate="maxlength: 300" rows="2"
                              style="resize: none">${entity.provider!}</textarea>
                </td>
            </tr>
            <tr>
                <th>选项</th>
                <td>
                    <div class="input-group">
                        <div class="icheck-inline">
                            <label>
                                <input class="jxcheck" name="status" <@html.isChecked value=entity.status /> type="checkbox" value="1"
                                       data-unchecked-value="0"> 启用
                            </label>
                            <label>
                                <input class="jxcheck" name="isPublic" <@html.isChecked value=entity.isPublic /> type="checkbox" value="1"
                                       data-unchecked-value="0"> 公开
                            </label>
                            <label>
                                <input class="jxcheck" name="isMenu" <@html.isChecked value=entity.isMenu /> type="checkbox" value="1"
                                       data-unchecked-value="0"> 菜单
                            </label>
                            <label>
                                <input class="jxcheck" name="isExpand" <@html.isChecked value=entity.isExpand /> type="checkbox" value="1"
                                       data-unchecked-value="0"> 展开
                            </label>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>备注</th>
                <td>
                    <textarea class="form-control" name="remark" maxlength="1000" data-validate="maxlength: 1000" rows="3"
                              style="resize: none">${entity.remark!}</textarea>
                </td>
            </tr>
        </table>
    </form>
    <div class="panel-footer text-right">
        <@html.editPanelFooter/>
    </div>
</div>
<@footer>
    <script>
        $('#selectIconCls').click(function () {
            jx.auth.iconDialog({
                inputId: 'iconCls',
                callback: function (val) {
                    if (val) {
                        $('#btnIconCls').empty().append('<i class="fa-lg ' + val + '"></i>');
                    }
                }
            });
        });
        jx.auth.bindEditFormSuccess();
    </script>
</@footer>